package com.example.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

/**
 * @ClassName CountService
 * @Description
 * @Author Jingxiao.Ye
 * @Date 2022/1/20 上午1:04
 * @Version V1.0
 * @Since JDK 11
 */
@Service
public class CountService {

    @Autowired
    private RedisTemplate<String,Object> redisTemplate;

    public void count(){
        //计数
        redisTemplate.opsForValue().increment("app_count",1);
        Long app_count = Long.parseLong(redisTemplate.opsForValue().get("app_count").toString());
        System.out.println(app_count);
    }
}
